import 'package:flutter/cupertino.dart';
import 'package:full_display/generated/l10n.dart';

class TimeProvider extends ChangeNotifier {
  final List listTime = ['08:00', '20:00'];

  List listWeek = [
    {"date": S.current.zhouyi, 'value': 1, "state": false},
    {"date": S.current.zhouer, 'value': 2, "state": false},
    {"date": S.current.zhousan, 'value': 3, "state": false},
    {"date": S.current.zhousi, 'value': 4, "state": false},
    {"date": S.current.zhouwu, 'value': 5, "state": false},
    {"date": S.current.zhouliu, 'value': 6, "state": false},
    {"date": S.current.zhouqi, 'value': 7, "state": false},
  ];

  String getWeek() {
    List tilelist = [];
    listWeek.every(
      (e) {
        if (e["state"] == true) {
          tilelist.add(e["date"]);
        }
        return true;
      },
    );

    return tilelist.isNotEmpty ? tilelist.join('、') : '';
  }

  void setStartTime(String time) {
    listTime[0] = time;
    notifyListeners();
  }

  void setEndTime(String time) {
    listTime[1] = time;
    notifyListeners();
  }
}
